// 懒加载图片指令的核心是应用了 IntersectionObserver API 来判断元素是否进入可视区，
export function initLazyIntersectionObserver(fn: (args: IntersectionObserverEntry) => any) {
  const observer = new IntersectionObserver((entryArr) => entryArr.forEach((entry) => fn(entry)), {
    rootMargin: '0px',
    threshold: 0
  })
  return observer
}
